Skip to content

Conversation

@brendt
Copy link
Member

@brendt brendt commented Nov 7, 2025

Technically this is a breaking change because of how the Route interface changed (added set hooks).

I don't think many people are relying on this, but I'm asking around on Discord first to be sure

@brendt brendt marked this pull request as draft November 7, 2025 13:51
@brendt brendt changed the title feat(router): route decorators feat(router)!: route decorators Nov 8, 2025
@brendt
Copy link
Member Author

brendt commented Nov 8, 2025

@innocenzi changing the Route interface is a breaking change.

The only mention in the docs about making your own route classes though is this: https://tempestphp.com/2.x/essentials/routing#group-middleware

While Tempest does not provide a way to group middleware, you can easily create your own route attribute that applies or excludes a set of middleware to a route.

How do you feel about it? Should we target 3.x?

@brendt brendt marked this pull request as ready for review November 8, 2025 05:46
@brendt brendt changed the title feat(router)!: route decorators feat(router)!: add route decorators Nov 8, 2025
@brendt
Copy link
Member Author

brendt commented Nov 10, 2025

I decided to merge this for 2.8: a poll on Discord shows that there's only a handful of people who would be affected by the change, and I've added a rector to make it easier.

The tl;dr is that Route classes must now also be writeable, so if they are declared readonly, that should be removed.

@brendt brendt merged commit c901dfe into main Nov 10, 2025
74 checks passed
@brendt brendt deleted the route-decorators branch November 10, 2025 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants